<?php

declare(strict_types=1);

namespace App\Controller;

use Hyperf\HttpServer\Contract\RequestInterface;
use Hyperf\HttpServer\Contract\ResponseInterface;
use User\GetUserInfoRequest;
use User\UserInfo;

class UserController
{
    public function index(RequestInterface $request, ResponseInterface $response)
    {
        return $response->raw('Hello Hyperf!');
    }

    public function getUserInfo(GetUserInfoRequest $getUserInfoRequest)
    {
        $userId = $getUserInfoRequest->getUserId();
        $userInfo = new UserInfo();
        $userInfo->setUserId($userId);
        $userInfo->setAddress('address --- ' . $userId);
        $userInfo->setUserName('userName --- ' . $userId);
        return $userInfo;
    }
}
